package com.lzx.adx.report.bean.mapper;


import com.lzx.adx.report.dto.ReportDTO;
import com.lzx.adx.report.dto.WphOrderDTO;
import com.lzx.adx.report.dto.YunxuanOrderDTO;
import com.lzx.adx.report.dto.yunxuan.YunXuanDTO;
import com.lzx.adx.report.entity.EleUnionOrderEntity;
import com.lzx.adx.report.entity.ReportEntity;
import com.lzx.adx.report.entity.WphOrderEntity;
import com.lzx.adx.report.model.common.CommonReportRequest;
import com.lzx.adx.report.model.elm.ElmUnionOrderDetail;
import com.lzx.adx.report.model.huawei.request.HwReportRequest;
import com.lzx.adx.report.model.ks.request.KsReportRequest;
import com.lzx.adx.report.model.meitu.request.MeituRequest;
import com.lzx.adx.report.model.tencent.request.TencentReportRequest;
import com.lzx.adx.report.model.toutiao.TouTiaoRequest;
import com.lzx.adx.report.model.youyou.YouYouRequest;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

@Mapper(componentModel = "spring")
public interface ReportMapper {

    @Mapping(source ="content_id",target ="contentId")
    @Mapping(source ="adgroup_id",target ="adgroupId")
    @Mapping(source ="campaign_id",target ="campaignId")
    @Mapping(source ="event_type",target ="eventType")
    @Mapping(source ="trace_time",target ="traceTime")
    @Mapping(source ="id_type",target ="imei")
    ReportDTO toReportDTO(HwReportRequest hwReportRequest);


    ReportDTO toReportDTO(CommonReportRequest hwReportRequest);

    WphOrderEntity toWphOrderEntity(WphOrderDTO dto);


    @Mapping(source ="imeiMd5",target ="imeiSum")
    @Mapping(source ="oaidMd5",target ="oaidSum")
    ReportDTO toReportDTO(YouYouRequest youYouRequest);

    @Mapping(source ="creative_id",target ="contentId")
    @Mapping(source ="ad_id",target ="adgroupId")
    @Mapping(source ="ad_group_id",target ="campaignId")
    @Mapping(source ="event_type",target ="eventType")
    @Mapping(source ="trace_time",target ="traceTime")
    ReportDTO toReportDTO(MeituRequest meituRequest);



    @Mapping(source ="click_id",target ="requestId")
    @Mapping(source ="click_time",target ="traceTime")
    @Mapping(source ="muid",target ="imei")
    @Mapping(source ="hash_oaid",target ="oaid")
    @Mapping(source ="campaign_id",target ="campaignId")
    @Mapping(source ="adgroup_id",target ="adgroupId")
    @Mapping(source ="ad_id",target ="contentId")
    ReportDTO toReportGTdDTO(TencentReportRequest tencentReportRequest);


    @Mapping(source ="content_id",target ="contentId")
    @Mapping(source ="adgroup_id",target ="adgroupId")
    @Mapping(source ="campaign_id",target ="campaignId")
    @Mapping(source ="event_type",target ="eventType")
    @Mapping(source ="trace_time",target ="traceTime")
    @Mapping(source ="imei",target ="imei")
    ReportDTO toReportKsReportDTO(KsReportRequest ksReportRequest);

    ReportEntity toReport(ReportDTO dto);




    @Mapping(source ="biz_order_id",target ="bizOrderId")
    @Mapping(source ="parent_order_id",target ="parentOrderId")
    @Mapping(source ="media_name",target ="mediaName")
    @Mapping(source ="media_id",target ="mediaId")
    @Mapping(source ="category_name",target ="categoryName")
    @Mapping(source ="pay_amount",target ="payAmount")
    @Mapping(source ="settle_amount",target ="settleAmount")
    @Mapping(source ="settle_state",target ="settleState")
    @Mapping(source ="settle_time",target ="settleTime")
    @Mapping(source ="shop_name",target ="shopName")
    @Mapping(source ="ext_info",target ="extInfo")
    @Mapping(source ="pay_time",target ="payTime")
    @Mapping(source ="trace_time",target ="traceTime")
    @Mapping(source ="order_state",target ="orderState")
    @Mapping(source ="order_item_status",target ="orderItemStatus")
    @Mapping(source ="flow_type",target ="flowType")
    @Mapping(source ="commission_rate",target ="commissionRate")
    @Mapping(source ="commission_fee",target ="commissionFee")
    @Mapping(source ="product_num",target ="productNum")
    @Mapping(source ="ad_zone_id",target ="adZoneId")
    EleUnionOrderEntity toEleUnionOrderEntity(ElmUnionOrderDetail orderDetailReportDTO);

    @Mapping(source ="biz_order_id",target ="id")
    List<EleUnionOrderEntity> toReport(List<ElmUnionOrderDetail> orderDetailReportDTO);

    ReportDTO toReportToutiaoReportDTO(TouTiaoRequest touTiaoRequest);

    @Mapping(source ="external_order_id",target ="id")
    @Mapping(source ="order_id",target ="orderId")
    @Mapping(source ="order_status",target ="orderStatus")
    @Mapping(source ="remit_status",target ="remitStatus")
    @Mapping(source ="create_time",target ="createTime")
    @Mapping(source ="product_source",target ="productSource")
    @Mapping(source ="order_source",target ="orderSource")
    @Mapping(source ="payed_time",target ="payedTime")
    YunxuanOrderDTO toReport(YunXuanDTO yunXuanDTO);
}
